package com.classtest.test2;

public class Cylinder extends Circle {
    private double height;//圆柱体的高

    public Cylinder() {
    }

    public Cylinder(double height) {
        this.height = height;
    }

    public Cylinder(double r, double h) {
        super(r);//手动调用带参构造
        this.height = h;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    //获取圆柱体面积
    public double getVolume(double r) {
        return super.getArea(r) * height;
    }
    //将圆柱体体积输出到屏幕
    @Override
    public void show(double r) {
        System.out.println("圆柱体体积为：" + getVolume(r));

    }

    //将圆柱体体积输出到屏幕
    public void showVolume(double r) {
        System.out.println("圆柱体体积为：" + getVolume(r));

    }
}
